#include<iostream>
#include<algorithm>
using namespace std;
const int N = 200;
int tong[N];

int main()
{
	int n, k; cin >> n >> k;
	string s; cin >> s;
	for (int i = 0; i < n; ++i)
	{
		if ((int)s[i] >= (int)'A' && (int)s[i] <= (int)'A' + k - 1)
			tong[s[i]]++;
	}
	sort(tong + (int)'A', tong + (int)'A' + k);
	cout << tong['A'] * k << '\n';

	return 0;
}